package com.cq.hd.order.factory.orderSelect;

import java.util.HashMap;
import java.util.Map;

public class OrderSelectFactory {

    private static final Map<Integer, AbstractOrderSelectHandler> STRATEGY_MAP = new HashMap<>();

    public static void register(Integer markType, AbstractOrderSelectHandler strategy) {
        STRATEGY_MAP.put(markType, strategy);
    }

    public static AbstractOrderSelectHandler getOrderSelectHandler(Integer type) {
        AbstractOrderSelectHandler abstractOrderSelectHandler = STRATEGY_MAP.get(type);
        if (abstractOrderSelectHandler == null) {
            throw new RuntimeException("处理类为空");
        }
        return abstractOrderSelectHandler;
    }


}
